import { clearWorkTypeMap } from '@/config/dict.js'
import { parseTime } from '@/utils/index'

export const taskListSearchForm = [
  {
    key: 'time',
    subKey: ['beginDate', 'endDate'],
    type: 'date',
    otherAttrs: {
      type: 'datetimerange',
      format: 'yyyy-MM-dd',
      style: 'width: 300px;',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间'
    }
  }
]

export const taskListColumn = [
  { label: '姓名', key: 'name', minWidth: 120 },
  { label: '任务类别', key: 'type', minWidth: 120, render: (_, rocord) => {
    return clearWorkTypeMap.find(e => e.key === rocord.row.type).value
  } },
  { label: '任务时段', key: 'type', minWidth: 160, render: (_, rocord) => {
    return rocord.row.startPeriod + ' - ' + rocord.row.endPeriod
  } },

  { label: '考勤日期', key: 'attendanceDate', minWidth: 160, render: (_, record) => {
    return parseTime(record.row.attendanceDate)
  } },

  { label: '车牌号', key: 'carPlatenumber', minWidth: 100 },

  { label: '规定清扫频次', key: 'frequency', minWidth: 120 },
  { label: '实际清扫次数', key: 'cleaningCount', minWidth: 120 }
]

